	<h2 class='header'>Members</h2>
	<span id='member-loading' class='hideme spinner'></span><br />
	<div id='member-flash' align='center'><?php echo $msg; ?></div>
	<form name='addmemberform' id='addmemberform' action='<?php echo HTTP_SERVER.ADMIN_DIR; ?>members' method='post'>
		<input type='hidden' name='submit' id='submit' value='1' />
		<table border='1' cellspacing='0' align='center'>
		<tr bgcolor='#CCEEBB'><td colspan='7' align='center'><p><b>Add New Member</b></p></td></tr>
		<tr>
			<th>Username</th>
			<th>Password</th>
			<th>Name</th>
			<th>Email</th>
			<th>Telephone</th>
			<th>Categories Access</th>
			<th>Action</th>
		</tr>
		<tr>
			<td>
				<input id='add_mem_username' name='add_mem_username' size='20' value='<?php echo $add_username; ?>' />
			</td><td>
				<input id='add_mem_password' name='add_mem_password' size='20' value='<?php echo $add_password; ?>' />
			</td><td>
				<input id='add_mem_name' name='add_mem_name' size='20' value='<?php echo $add_name; ?>' />
			</td><td>
			<input id='add_mem_email' name='add_mem_email' size='30' value='<?php echo $add_email; ?>' />
			</td><td>
				<input id='add_mem_tel' name='add_mem_tel' size='12' value='<?php echo $add_tel; ?>' />
			</td><td>
				<select id='add_mem_access' name='add_mem_access[]' size='4' multiple='multiple' style='width:200px;'>
				<?php
					$db->Query("SELECT * FROM category");
					while($db->getRow()) {
						echo "<option value='".$db->access['id']."'"; if(in_array($db->access['id'],$add_cat)) echo " selected='selected'"; echo ">".$db->access['name']."</option>";
					}
				?>
				</select>
			</td><td align='center'>
				<input type='submit' name='submit' id='addmember' class='button' value='Add' />
			</td>
		</tr>
		</table>
		</form>

		<br />

		<table border='1' cellspacing='0' align='center'>
		<tr bgcolor='#BBCCEE'>
			<td colspan='7' align='center'><p><b>Current Members</b></p></td>
		</tr>
		<tr>
			<th>Username</th>
			<th>Password</th>
			<th>Name</th>
			<th>Email</th>
			<th>Telephone</th>
			<th>Categories Access</th>
			<th>Action</th>
		</tr>
		<?php
			$db->Query("SELECT * FROM member WHERE access!='0';");
			$members = $db->getResults();
			foreach($members as $mem) {
				$myaccess = explode(",", $mem['access']);
				echo "<form name='updatememberform' id='updatememberform' action='".HTTP_SERVER.ADMIN_DIR."members' method='post'>
							<tr valign='center'>
								<td>
									<input id='edit_mem_username".$mem[0]."' name='edit_mem_username".$mem[0]."' class='required' size='20' value='".$mem[1]."' />
								</td><td>
									<input id='edit_mem_password".$mem[0]."' name='edit_mem_password".$mem[0]."' size='20' value='' />
								</td><td>
									<input id='edit_mem_name".$mem[0]."' name='edit_mem_name".$mem[0]."' size='20' value='".$mem[3]."' />
								</td><td>
									<input id='edit_mem_email".$mem[0]."' name='edit_mem_email".$mem[0]."' size='30' value='".$mem[4]."' />
								</td><td>
									<input id='edit_mem_tel".$mem[0]."' name='edit_mem_tel".$mem[0]."' size='12' value='".$mem[5]."' />
								</td><td>
									<select id='edit_mem_access".$mem[0]."' name='edit_mem_access".$mem[0]."[]' size='4' multiple='multiple' class='required' style='width:200px;'>";
									$db->Query("SELECT * FROM category");
									while($db->getRow()) {
										echo "<option value='".$db->access['id']."' "; if(in_array($db->access['id'], $myaccess)) echo "selected='selected'"; echo ">".$db->access['name']."</option>";
									}
						echo "</select>
								</td><td align='center'>
									<input type='image' name='submit".$mem[0]."' id='update".$mem[0]."' src='".HTTP_SERVER.IMG_DIR."b_edit.png' alt='Update' value='Update' /> |
									<input type='image' name='submit".$mem[0]."' id='delete".$mem[0]."' src='".HTTP_SERVER.IMG_DIR."b_del.png' alt='Delete' value='Delete' onclick=\"return confirm('Are you sure you want to delete this member?');\" />
								</td>
							</tr></form>";
			}
		?>
		</table>
	<br />